import { Component, OnInit, ViewChild } from "@angular/core";
import { Router } from '@angular/router';
import { MessageService } from 'src/app/core/service/message.service';
import { NzCarouselModule } from 'ng-zorro-antd/carousel';
import { ApiService } from 'src/app/core/api';
import { NzMessageService } from 'ng-zorro-antd';

@Component({
    templateUrl: "./index.html",
    styleUrls: ["./index.scss"]
})
export class IndexComponent implements OnInit {
	phoneNum;
	imgs = [
		'banner1.png', 
		'banner2.png', 
		'banner3.png'
	];
	idcardBackImage;
	statusDatas=[{
		v: 1,
		name: '委托检测'
	}, {
		v: 2,
		name: '型式检测'
	}, {
		v: 3,
		name: '远程检测'
	}]
	page = {
		"pageNo":"1",
    	"testType":"T1" 
	};
	
    constructor(
		private router: Router,
		private api: ApiService,
		private msg: NzMessageService,
        private message:MessageService
    ) {}

    ngOnInit() {
		this.api.post('banner',{}).then((res: any) => {
			// this.imgs = res.data.list;
        }).catch((res) => {
            this.msg.error(res.message);
		});
	
		
    }
    bannerTo(item) {
		//routerLink="/agency" [queryParams]='{id:i.productId}'
		if (item.url) {
			window.open(item.url);
		} else {
			if (item.openType == 'Recruit') {
				// 去活动页
				this.router.navigate(['/activity'], {
					queryParams: { id: item.productId }
				});
			} else {
				this.router.navigate(['/agency'], {
					queryParams: { id: item.productId }
				});
			}
		}
	}
	onChangeSearch(){
	}
	showMsgWindow(){
		this.message.sendMessage('showMsgWindow','member');
	}
}
